package com.dyc.caradvertisting.ui.aty.main;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.WindowManager;

import com.dyc.caradvertisting.R;
import com.dyc.caradvertisting.ui.aty.yd.YDActivity;
import com.dyc.caradvertisting.ui.fmt.tab.main.MainFragment;
import com.njh.tools.common.phone.ToActivityUtil;
import com.njh.tools.common.userInfo.SPUserInfo;
import com.njh.tools.config.tconstant.Constants;

import me.yokeyword.fragmentation.SupportActivity;
import me.yokeyword.fragmentation.anim.DefaultHorizontalAnimator;
import me.yokeyword.fragmentation.anim.FragmentAnimator;

public class MainAty extends SupportActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // 默认软键盘不弹出
        getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
        if (savedInstanceState == null) {
            loadRootFragment(R.id.fl_container, MainFragment.newInstance());
        }
        if (SPUserInfo.getIsLogin(this) ==false){
            ToActivityUtil.getInstance().toNext(this, YDActivity.class);
        }
    }

    @Override
    public void onBackPressedSupport() {
        // 对于 4个类别的主Fragment内的回退back逻辑,已经在其onBackPressedSupport里各自处理了
        super.onBackPressedSupport();
    }

    @Override
    public FragmentAnimator onCreateFragmentAnimator() {
        // 设置横向(和安卓4.x动画相同)
        return new DefaultHorizontalAnimator();
    }
}
